1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module pango.PgAttributeShape; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import pango.PgAttribute; 30 private import pango.c.functions; 31 public import pango.c.types; 32 33 34 /** 35 * The `PangoAttrShape` structure is used to represent attributes which 36 * impose shape restrictions. 37 */ 38 public class PgAttributeShape : PgAttribute 39 { 40 /** the main Gtk struct */ 41 protected PangoAttrShape* pangoAttrShape; 42 43 /** Get the main Gtk struct */ 44 public PangoAttrShape* getPgAttributeShapeStruct(bool transferOwnership = false) 45 { 46 if (transferOwnership) 47 ownedRef = false; 48 return pangoAttrShape; 49 } 50 51 /** the main Gtk struct as a void* */ 52 protected override void* getStruct() 53 { 54 return cast(void*)pangoAttrShape; 55 } 56 57 /** 58 * Sets our main struct and passes it to the parent class. 59 */ 60 public this (PangoAttrShape* pangoAttrShape, bool ownedRef = false) 61 { 62 this.pangoAttrShape = pangoAttrShape; 63 super(cast(PangoAttribute*)pangoAttrShape, ownedRef); 64 } 65 66 67 /** 68 * Create a new shape attribute. 69 * 70 * A shape is used to impose a particular ink and logical 71 * rectangle on the result of shaping a particular glyph. 72 * This might be used, for instance, for embedding a picture 73 * or a widget inside a `PangoLayout`. 74 * 75 * Params: 76 * inkRect = ink rectangle to assign to each character 77 * logicalRect = logical rectangle to assign to each character 78 * 79 * Returns: the newly allocated 80 * `PangoAttribute`, which should be freed with 81 * [method@Pango.Attribute.destroy] 82 * 83 * Throws: ConstructionException GTK+ fails to create the object. 84 */ 85 public this(PangoRectangle* inkRect, PangoRectangle* logicalRect) 86 { 87 auto __p = pango_attr_shape_new(inkRect, logicalRect); 88 89 if(__p is null) 90 { 91 throw new ConstructionException("null returned by new"); 92 } 93 94 this(cast(PangoAttrShape*) __p); 95 } 96 97 /** 98 * Creates a new shape attribute. 99 * 100 * Like [func@Pango.AttrShape.new], but a user data pointer 101 * is also provided; this pointer can be accessed when later 102 * rendering the glyph. 103 * 104 * Params: 105 * inkRect = ink rectangle to assign to each character 106 * logicalRect = logical rectangle to assign to each character 107 * data = user data pointer 108 * copyFunc = function to copy @data when the 109 * attribute is copied. If %NULL, @data is simply copied 110 * as a pointer 111 * destroyFunc = function to free @data when the 112 * attribute is freed 113 * 114 * Returns: the newly allocated 115 * `PangoAttribute`, which should be freed with 116 * [method@Pango.Attribute.destroy] 117 * 118 * Since: 1.8 119 * 120 * Throws: ConstructionException GTK+ fails to create the object. 121 */ 122 public this(PangoRectangle* inkRect, PangoRectangle* logicalRect, void* data, PangoAttrDataCopyFunc copyFunc, GDestroyNotify destroyFunc) 123 { 124 auto __p = pango_attr_shape_new_with_data(inkRect, logicalRect, data, copyFunc, destroyFunc); 125 126 if(__p is null) 127 { 128 throw new ConstructionException("null returned by new_with_data"); 129 } 130 131 this(cast(PangoAttrShape*) __p); 132 } 133 }